import 'package:flutter/material.dart';

//根据child的baseline，来调整child的位置
class BaselineWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: new AppBar(
          title: new Text("Baseline"),
          leading: new BackButton(),
        ),
        body: new Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            new Baseline(
              baseline: 50,
              /* alphabetic：对齐字符底部的水平线；
               *  ideographic：对齐表意字符的水平线。 */
              baselineType: TextBaseline.alphabetic,
              child: new Text(
                'woshizhangjunwen',
                style: new TextStyle(
                    fontSize: 18, textBaseline: TextBaseline.alphabetic),
              ),
            ),
            new Baseline(
              baseline: 50,
              baselineType: TextBaseline.alphabetic,
              child: new Container(
                width: 30,
                height: 30,
                color: Colors.red,
              ),
            ),
            new Baseline(
              baseline: 50,
              baselineType: TextBaseline.alphabetic,
              child: new Text(
                'shuaigeyihao',
                style: new TextStyle(
                  fontSize: 30,
                  textBaseline: TextBaseline.alphabetic,
                ),
              ),
            )
          ],
        ));
  }
}
